package com.github.ylt.protocol.http.server.exchange;

import com.github.ylt.protocol.http.Headers;
import com.github.ylt.protocol.http.HttpContext;
import com.github.ylt.protocol.http.server.request.Request;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.URI;

public abstract class HttpExchange implements AutoCloseable, Request {
    protected HttpExchange (){}
    public abstract URI getRequestURL();
    public abstract String getMethod();
    public abstract Headers getRequestHeaders();
    public abstract Headers getResponseHeaders();
    public abstract String getFullRequestURL();
    public abstract HttpContext getContext();

    public abstract void close();
    public abstract InputStream getRequestBody();
    public abstract OutputStream getResponseBody();
    public abstract void sendResponse(String message)  throws IOException;
    public abstract void setResponseCode(int code);
    public abstract InetSocketAddress getRemoteAddress();
    public abstract int getResponseCode();
    public abstract InetSocketAddress getLocalAddress();
    public abstract String getProtocol();
    public abstract Object getAttribute(String name);
    public abstract void setAttribute(String name, Object value);
    public abstract void setStreams(InputStream i, OutputStream o);
    public abstract boolean isHeadRequest();
    public abstract boolean isGetRequest();
    public abstract boolean isPostRequest();
    public abstract boolean isPutRequest();
    public abstract boolean isDeleteRequest();
    public abstract boolean isNotifyRequest();
    public abstract boolean isSubscribeRequest();
    public abstract boolean isUnsubscribeRequest();
    public abstract boolean isSOAPRequest();
    public abstract String getAction();
}
